home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / comm / bbs / Hydra11s.lha / HBBS / Source / Test / SharedLib / READ.ME < prev    next >
Text File  |  1996-06-25  |  2KB  |  65 lines

  1. DEBUGGING SHARED LIBRARIES
  2. --------------------------
  3.  
  4. To debug a shared library, perform the following steps:
  5.  
  6. 1. Build the library.
  7.  
  8.    Just type "SMAKE" in the Shell or double-click on the "Build" icon.
  9.    
  10.    SMAKE will build the library "mylib.library" and install it in your
  11.    LIBS: directory.  It will build the test program "test" in the current
  12.    directory.
  13.  
  14. 2. Run the test program under the debugger.
  15.  
  16.    From the Shell, type
  17.    
  18.       cpr test
  19.  
  20.    or from Workbench, click on the "Debug" icon, hold down the SHIFT key
  21.    and double-click on the "test" icon.
  22.  
  23. 3. Let CPR know you want to debug shared libraries.
  24.  
  25.    Type the following in the dialog window:
  26.    
  27.       opt reslib on
  28.  
  29.    or use the mouse to select the "Step into Reslib?" menu item from the 
  30.    "Options" menu.
  31.  
  32. 4. Set a breakpoint in the library routine and proceed.
  33.  
  34.    Type the following in the CPR dialog window:
  35.    
  36.       b mylib.library:LIBtest1
  37.       go
  38.  
  39.    After typing "go", you should see CPR stop at the routine "test1" in your
  40.    library.  The LIB preceding the name "test1" may vary depending on how you
  41.    specify the LIBPREFIX option.  Only functions that are listed in your .fd
  42.    file need the prefix.
  43.  
  44. 5. Use the debugger normally.
  45.  
  46.    Anything you can do in the debugger under normal circumstances is legal
  47.    in the shared library.  Try setting the value of the external variable "b":
  48.    
  49.       set b = 10
  50.       go
  51.  
  52.    You should hit your breakpoint again.  Go to the workbench by clicking on
  53.    the front-to-back gadget in the upper right-hand corner.  You'll see that
  54.    the function test1 returned 10.
  55.  
  56. 6. Clear all breakpoints and allow the program to complete.
  57.  
  58.       bc *
  59.       go
  60.  
  61.    Note that under both AmigaDOS 1.3 and 2.0, there will be a short delay
  62.    because the test program calls the Delay() function.  Under AmigaDOS 2.0,
  63.    you will have to go to the workbench and click on the close gadget of the
  64.    program before the program will terminate.
  65.